 /**  
 * @fileOverview 自动补全主函数
 * @author tan
 * @version 1.0  
 */  
 /**  
 * @author tan  
 * @constructor 自动补全主函数
 * @description 自动补全主函数
 * @date 2011-10-24
 * @since version 1.0 
 */ 

var autocomplete=function(){
	
	this.bindAutoComplete=function(inputId,_url,propertyName){
		var cache = {};
		$(inputId).autocomplete({
			minLength: 1,
			source: function(request, response) {
				if ( request.term in cache ) {
					response( cache[request.term] );
					return;
				}
				$.post(_url,'term='+request.term+'&propertyName='+propertyName,function(data){
					cache[ request.term]=data;
					response(data);
				});
			}
		});
	}
}();